<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page language="java" contentType="text/html; charset=BIG5"
    pageEncoding="BIG5"%>

<!-- Add Digital goods in-context experience. Ensure that this script is added before the closing of html body tag -->

<script src='https://www.paypalobjects.com/js/external/dg.js'
	type='text/javascript'></script>


<script>
	var dg = new PAYPAL.apps.DGFlow({
		trigger : 'paypal_submit',
		expType : 'instant'
	//PayPal will decide the experience type for the buyer based on his/her 'Remember me on your computer' option.
	});
</script>

<div id="container">
	<br />
	<h2>Shopping Cart</h2>
	<br /> <br />

	<div class="cartItemWrapper">

		<div class="cartItemTitle">
			<div class="picTitle">Picture</div>
			<div class="nameTitle">Name</div>
			<div class="colorTitle">Color</div>
			<div class="sizeTitle">Size</div>
			<div class="quantityTitle">Quantity</div>
			<div class="priceTitle">Unit Price</div>
			<div class="totalTitle">Total</div>
			<div class="delTitle"></div>
		</div>

			<s:iterator value="#session.cart">

				<div class="cartItem">
				
					<div class="pic">
						<img width="75" height="100" class="zoom-tiny-image"
							src="img/product_line_id/<s:property value="getCartItemProductLineId()" />A.jpg" />
					</div>
					<div class="name">
						<s:property value="getCartItemName()" />
					</div>
					<div class="color">
						<s:property value="getCartItemColor()" />
					</div>
					<div class="size">
						<s:property value="getCartItemSize()" />
					</div>
					<div class="quantity">
						<s:property value="quantity" />
						units
					</div>
					<div class="price">
						$
						<s:property value="getCartItemPrice()" />
					</div>
					<div class="total">
						$
						<s:property value="getCartItemAmount()" />
					</div>
					<div class="del">
						<a
							href="<s:url action="delToCart"><s:param name="productItemId" ><s:property value="%{productItemId}"/></s:param></s:url>">Del</a><br />
						<br />
					</div>
				</div>

			</s:iterator>
	</div>

	<div class="summary">
		Total:$
		<s:property value="getAmount()" />
		<br />

		<!-- INFO: The post URL "checkout.java" is invoked when clicked on "Pay with PayPal" button.-->

		<form method="post" action="${initParam['posturl'] }">

				<input type="hidden" name="upload" value="1" /> 
				<input type="hidden" name="return" value="${initParam['returnurl'] }" /> 
				<input type="hidden" name="cmd" value="_cart" /> 
				<input type="hidden" name="business" value="${initParam['business'] }" />
				<s:set var="countershoppingcart" value="1" />
				
 				<s:iterator value="#session.cart">
				
					<!-- Product 1 -->
					<input type="hidden" name="item_name_<s:property value="%{#countershoppingcart}" />" value=<s:property value="getCartItemName()"/> />
					<input type="hidden" name="item_number_<s:property value="%{#countershoppingcart}" />" value="<s:property value="%{productItemId}"/>" />
					<input type="hidden" name="amount_<s:property value="%{#countershoppingcart}" />" value=<s:property value="getCartItemPrice()"/> />
					<input type="hidden" name="quantity_<s:property value="%{#countershoppingcart}" />" value=<s:property value="quantity"/> />
					
					<s:set var="countershoppingcart" value="%{#countershoppingcart+1}" />
					
				</s:iterator>

				<input type="image" name="submit" style="border:0px" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" alt="PayPal - The safer, easier way to pay online">
			
		</form>
					
	</div>
	


</div>